/* JS框架设计		
* @author lovefuwp.cn
* date:2011-04-14 09:23:05 
*/
	
	//实例化选择器
	var Super = function ( selector, context ){		
		return new Super.init( selector, context );
	}
	
	// 插入后面
	Super.inertAfter=function(newElement,targetElement){// 插入
		var parent = targetElement.parentNode;
		if(parent.lastChild == targetElement){
			parent.appendChild(newElement);
		}
		else{
			parent.insertBefore(newElement,targetElement.nextSibling);
		}
	}
	function $() {
		  var elements = new Array();

		  for (var i = 0; i < arguments.length; i++) {
		    var element = arguments[i];
		    if (typeof element == 'string')
		      element = document.getElementById(element);

		    if (arguments.length == 1)
		      return element;

		    elements.push(element);
		  }

		  return elements;
		}
	// 封装ajax
	Super.Ajax=function(url,backFunc){
		var xmlHttp;
		var now = new Date().getTime();		
		xmlHttp = GetXmlHttpObject();
		xmlHttp.open("POST",url+"&r=" + now, true);	
		xmlHttp.onreadystatechange = function(){		
			if(xmlHttp.readyState == 4){
	            if(xmlHttp.status == 200){
	            	var xmlResponse = xmlHttp.responseText;	            	
	            	backFunc(xmlResponse);
	            }
	        }
		};	
		xmlHttp.send(null);		
	}
	Super.getXmlValue=function(obj,id){
		if(!obj.getElementsByTagName(id)[0].lastChild){return "";}
		else{return obj.getElementsByTagName(id)[0].lastChild.nodeValue;}	
	}
	// 获取滚动条的高度
	Super.getPageScroll=function (){
		var yScroll;
		if (self.pageYOffset) {
			yScroll = self.pageYOffset;
		} else if (parent.document.documentElement && parent.document.documentElement.scrollTop){
			yScroll = parent.document.documentElement.scrollTop;
		} else if (parent.document.body) {
			yScroll = parent.document.body.scrollTop;
		}		
		arrayPageScroll = new Array('',yScroll)
		return arrayPageScroll;
	}

	// 获取页面实际大小
	Super.getPageSize=function (){
		var xScroll,yScroll;		
		if (window.innerHeight && window.scrollMaxY){
			xScroll = parent.document.body.scrollWidth;
			yScroll = window.innerHeight + window.scrollMaxY;
		} else if (parent.document.body.scrollHeight > parent.document.body.offsetHeight){
			xScroll = parent.document.body.scrollWidth;
			yScroll = parent.document.body.scrollHeight;
		} else {
			xScroll = parent.document.body.offsetWidth;
			yScroll = parent.document.body.offsetHeight;
		}
		
		var windowWidth,windowHeight;
		if (self.innerHeight) {
			windowWidth = self.innerWidth;
			windowHeight = self.innerHeight;
		} else if (parent.document.documentElement && parent.document.documentElement.clientHeight) {
			windowWidth = parent.document.documentElement.clientWidth;
			windowHeight = parent.document.documentElement.clientHeight;
		} else if (parent.document.body) {
			windowWidth = parent.document.body.clientWidth;
			windowHeight = parent.document.body.clientHeight;
		}		
		var pageWidth,pageHeight
		if(yScroll < windowHeight){
			pageHeight = windowHeight;
		} else {
			pageHeight = yScroll;
		}
		if(xScroll < windowWidth) {
			pageWidth = windowWidth;
		} else {
			pageWidth = xScroll;
		}
		arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
		return arrayPageSize;
	}
	// CreateContainer 创建容器
	Super.CreateContainer=function(id,top,left,width,height){
				
	} 
	/*
	 * editData 列表项编辑函数 url:edit action
	 */
	Super.editData=function(url,popWidth,popHeight){
		var checkBox=document.getElementsByName("checkbox");
		var str="";
		for(i=0;i<checkBox.length;i++){
		 if(checkBox[i].checked==true){
		 		if(str==""){
					if(checkBox[i].value!="checkbox"){
						str=str+checkBox[i].value;
					}
		 		}else{
		 			str=str+","+checkBox[i].value;
		 		}
		 	}
		}
		if(str.split(",").length<2 && str!="" ){
			var urlAddress =url+str;
			
	    	Super.Popup(5,"编辑",urlAddress,"",popWidth,popHeight);
		}
		if(str.split(",").length>1){
			Super.Popup(2,"警告","","每次只能编辑一条数据！");
			return false;
		}
		if(str==""){
			Super.Popup(2,"警告","","请至少选择一条数据！");
			return false;
		}
	}
	/*
	 * delData 列表项删除函数 url:del action
	 */
	Super.delData=function (url,delFlag){
		var checkBox=document.getElementsByName("checkbox");
		var str="";
		for(i=0;i<checkBox.length;i++){		
			if(checkBox[i].checked == true){
				if(str==""){
					if(checkBox[i].value!="checkbox"){
						str=str+checkBox[i].value;
					}
		 		}else{
		 			str=str+","+checkBox[i].value;
		 		}						
			}
		}
		if(delFlag){
			str=delFlag;
		}
		if(str==""){
			Super.Popup(2,"警告","","请至少选择一条数据！");
		}
		else{
			var urlAddress=url+str;
			if(delFlag){
				Super.singlePopup(4,"提示",urlAddress,"你确定要删除这些数据吗？");
			}else{
				Super.Popup(4,"提示",urlAddress,"你确定要删除这些数据吗？");
			}
			return false;	
		}
	}

	/*
	 * uploadData 列表项上传函数 url:del action
	 */
	Super.uploadData=function (url){
			var urlAddress=url;
			Super.Popup(4,"提示",urlAddress,"你确定要上传这些数据吗？");
			return false;	
	}	
	
	// 临时
	function loading(){
		if(document.getElementById("loading")){
			$("loading").style.display="";
			document.forms[0].submit();
		}
	}
	function rightCheck2(id,status)
	{		
		var checkRight=document.getElementById("insertRole_checkRight");
		var chbox=document.getElementsByName(id.name);
		var chboxLen=chbox.length;
		for(i=0;i<chboxLen;i++){
			chbox[i].checked=status;
			if(status==false){
				var objVal=chbox[i].value+",";
				checkRight.value=checkRight.value.replace(objVal,'');
				
			}
			else{
				var ss = checkRight.value.indexOf(chbox[i].value);
			  	
			  	if(ss<0){
				checkRight.value=checkRight.value+chbox[i].value+",";
				}
			}
			
		}

	}
	function rightCheck1(obj,status)
	{		
		var checkRight=document.getElementById("insertRole_checkRight");
			if(status==false){
				var objVal=obj.value+",";
				checkRight.value=checkRight.value.replace(objVal,'');
				
			}
			else{
				var parentHeader=document.getElementsByName(obj.name)[0].value;
				var ss = checkRight.value.indexOf(parentHeader);			  	
			  	if(ss<0){
			  		checkRight.value=checkRight.value+parentHeader+","+checkRight.value+obj.value+",";
				}else{
					checkRight.value=checkRight.value+obj.value+",";}
			}
	}
	/*
	 * checkAll 选择当前页所有符合的checkbox
	 * 
	 */
	Super.checkAll=function (status,checkName)
	{	
		var chbox;
		if(checkName!=null){
			chbox=document.getElementsByName(checkName);
		}else{
			chbox=document.getElementsByName("checkbox");
		}
		
		
		var chboxLen=chbox.length;
		for(i=0;i<chboxLen;i++){
			chbox[i].checked=status;
			}
	}
	// 获取字符长度
	Super.getLength=function(str){
	     var length = str.length;
	     for(var i = 0; i < str.length; i++)
	      if(/[\u4e00-\u9fa5]/.test(str.charAt(i)))
	       length ++;
	     return length;
	}
	// 输入检验
	Super.checkvalue=function(obj){
		var inputs=obj.getElementsByTagName("input");	
		// jQuery.noConflict();
		// var inputs = jQuery(obj).find("input");
		
		for(var i=0;i<inputs.length;i+=1){
			if (inputs[i].value==""&&(inputs[i].type=="text"||inputs[i].type=="file")) {
				if ((i < inputs.length - 1) && (inputs[i+1].value.indexOf("must-input") >= 0)) {
					Super.Popup(2,"警告","",inputs[i].title+"不能为空!");
					return false;
				}
			}
	
			// 特殊字符验证
			var pattern = new RegExp("[`~!@#$^&*=|{}';'\\[\\]<>/?~！@#￥……&*—|{}【】‘；：”“'。，、？]");
			if(pattern.test(inputs[i].value)&&inputs[i].type=="text"){
				Super.Popup(2,"警告","",inputs[i].title+"不能有特殊字符!");
				return false;
			}
			
			// 判断密码不能为空
			if(inputs[i].value==""&&inputs[i].type=="password"){
				Super.Popup(2,"警告","",inputs[i].title+"不能为空!");
				return false;
			}
			// 判断密码相同
			if(inputs[i].value!=""&&inputs[i].type=="password"){
				if(inputs[i].title=="密码"&&inputs[i+2].value==""){					
						Super.Popup(2,"警告","","重复密码不能为空!");
						return false;
				}
				if(inputs[i].title=="密码"&&inputs[i+2].value!=""){	
						if(inputs[i].value!=inputs[i+2].value){
							Super.Popup(2,"警告","","密码输入不一致!");
							return false;
						}
				}
				if(inputs[i].title=="重复密码"&&inputs[i-2].value==""){					
					Super.Popup(2,"警告","","密码不能为空!");
					return false;
				}
				if(inputs[i].title=="重复密码"&&inputs[i-2].value!=""){	
						if(inputs[i].value!=inputs[i-2].value){
							Super.Popup(2,"警告","","密码输入不一致!");
							return false;
						}
				}
								
			}
			if(inputs[i].value!=""&&inputs[i].type=="text"){
				if(Super.getLength(inputs[i].value)>500){
					Super.Popup(2,"警告","",inputs[i].title+"不能输入超过500个字符!");
					return false;
				}
				if ((i < inputs.length - 1) && (inputs[i+1].value.indexOf("must-number") >= 0)) {
					var areaNum = "^[0-9]+$";
					var ra = new RegExp(areaNum);
					if (!ra.test(inputs[i].value)) {
						Super.Popup(2,"警告","",inputs[i].title+"只能输入正整数!");
						return false;
					}
				}
			}			
		}
		return true;		
	}
	// getParentObject
	Super.getParentObject=function(id){
		return parent.document.getElementById(id);		
	}
	Super.singlePopup=function(popType,popTitle,popUrl,popText,popWidth,popHeight){
		var arrayPageSize   = Super.getPageSize();// 调用getPageSize()函数
		var arrayPageScroll = Super.getPageScroll();// 调用getPageScroll()函数
		if(typeof popWidth == "undefined"){
			popWidth=300;
			popHeight=100;
		}
		var popupDiv = parent.document.createElement("div");		
		// 给这个元素设置属性与样式
		popupDiv.setAttribute("id","popupAddrSingle");
		popupDiv.style.position = "absolute";
		popupDiv.style.border = "2px solid #5894E1";
		popupDiv.style.background = "#fdfdff";
		popupDiv.style.zIndex = 999999;
		
		var bodyBack = parent.document.createElement("div");
		bodyBack.setAttribute("id","bodybgSingle");
		bodyBack.style.position = "absolute";
		bodyBack.style.width = "100%";
		bodyBack.style.height = (arrayPageSize[1] + 35 + 'px');
		bodyBack.style.zIndex =999998;
		bodyBack.style.top = "0";
		bodyBack.style.left = "0";		
		bodyBack.style.filter = "alpha(opacity=20)";
		bodyBack.style.opacity = "0.5";
		bodyBack.style.background = "#000";
		// 创建遮罩的Iframe层
		var bodyIframe =parent.document.createElement("iframe");
		bodyIframe.setAttribute("id","bodyIframeSingle");
		bodyIframe.style.position = "absolute";		
		bodyIframe.style.width = "100%";
		bodyIframe.style.height = "100%";
		bodyIframe.style.zIndex = "-1";
		bodyIframe.style.top = "0";
		bodyIframe.style.left = "0";
		bodyIframe.style.scrolling= "no"
		bodyIframe.style.filter = "alpha(opacity=1)";
		bodyIframe.style.opacity = "0.5";
		bodyIframe.style.background = "#000";
		bodyIframe.frameBorder = "0";
		bodyIframe.src="about:blank";
				
		// 实现弹出(插入到目标元素之后)
		parent.document.body.appendChild(popupDiv);		
		parent.document.body.appendChild(bodyBack);	
		// alert(parent.document.body.innerHTML);
		bodyBack.appendChild(bodyIframe);
		
		parent.document.getElementById("bodybgSingle").style.display = "";	
		var popObj=parent.document.getElementById("popupAddrSingle");
		var msgHeader=parent.document.createElement("h1");
		msgHeader.setAttribute("id","msgHeaderSingle");
		msgHeader.style.position="relative"; 
		msgHeader.style.padding="5px 0 5px 10px"; 
		msgHeader.style.zIndex="1000000000"; 
		msgHeader.style.borderBottom="1px solid #D1DEED"; 
		msgHeader.style.background="#E3EBF4";
		msgHeader.style.color="#15428B"; 
		msgHeader.style.fontSize="12px"; 
		msgHeader.style.fontWeight="bold";
		msgHeader.innerHTML=popTitle;
		popObj.appendChild(msgHeader);			
						
		var msgImg=parent.document.createElement("img");// close image
		msgImg.setAttribute("id","msgImgSingle");
		msgImg.setAttribute("src","/SCMDB/images/msgClose.gif");
		msgImg.setAttribute("title","关闭");	
		msgImg.style.position="absolute"; 
		msgImg.style.right="3px"; 
		msgImg.style.top="5px"; 
		msgImg.style.cursor="pointer";
		msgHeader.appendChild(msgImg);
		parent.document.getElementById("msgImgSingle").onclick=function (){Super.closeLayer("");}
		
		msgDetail=parent.document.createElement("p");
		msgDetail.setAttribute("id","msgDetailSingle");
		msgDetail.style.background="url(/SCMDB/images/msgImg_0"+popType+".gif) no-repeat 0 0px";
		msgDetail.style.position = "relative";
		msgDetail.style.width=(popWidth-80)+"px";
		msgDetail.style.height=(popHeight-70)+"px";
		msgDetail.style.zIndex = 1000000;
		msgDetail.style.margin="10px 10px 5px 15px";
		msgDetail.style.padding="5px 0 4px 40px"; 
		msgDetail.style.fontSize="12px"; 
		msgDetail.style.textAlign="left";
		msgDetail.style.overflow="hidden";
		popObj.appendChild(msgDetail);
		msgDetail.innerHTML=popType==5?"<iframe name=\"popIframe\" id=\"popIframeSingle\" style=\"position:absolute;top:0px;right:0px;bottom:0px;left:0px;margin:0px;padding:0px;width:100%;height:100%;*width:"+(popWidth-50)+"px;overflow:hidden;\" src=\""+popUrl+"\" frameborder=\"0\" scrolling=\"auto\" ></iframe>":popText;			
		
		msgButton=parent.document.createElement("div");// close button
														// layer
		msgButton.setAttribute("id","msgButtonSingle");			
		msgButton.style.zIndex = 1000000;
		msgButton.style.textAlign="center";
		msgButton.style.padding="0 0 0 0";
		msgButton.style.fontSize="12px";
		popObj.appendChild(msgButton);
		var msgContent=popType==2?"<input id=\"msgCancelSingle\" type='button'  style='width:50px; background:url(/SCMDB/images/template_07.gif) no-repeat; border:0px; text-align:center;line-height:18px;font-size:12px; margin:0 0 5px 5px; height:24px;  cursor:pointer;' value='确定'/>":"<input id=\"msgConfirmSingle\" style='width:50px; background:url(/SCMDB/images/template_07.gif) no-repeat; border:0px; text-align:center;line-height:18px;font-size:12px; margin:0 0 5px 5px; height:24px;  cursor:pointer;' type='button' value='确定' /><input id=\"msgCancelSingle\" style='width:50px; background:url(/SCMDB/images/template_07.gif) no-repeat; border:0px; text-align:center;line-height:18px;font-size:12px; margin:0 0 5px 5px; height:24px;  cursor:pointer;' type='button' value='取消' />";
		msgButton.innerHTML=msgContent;
		if(parent.document.getElementById("msgConfirmSingle")){
			parent.document.getElementById("msgConfirmSingle").onclick=function (){Super.closeLayerSingle(popUrl);}
		}
		if(parent.document.getElementById("msgCancelSingle")){
			parent.document.getElementById("msgCancelSingle").onclick=function (){Super.closeLayerSingle("");}				
		}
		popObj.style.display = "";		
		// 让弹出层在页面中垂直左右居中(统一)
		popObj.style.width  = popWidth+"px";	
		popObj.style.top  = arrayPageScroll[1] + (arrayPageSize[3]-popHeight) / 2 + 'px';
		popObj.style.left = (arrayPageSize[0] - popWidth) / 2 + 'px';
	}
	Super.closeLayerSingle=function(url){
		if(url){
			document.forms[0].action=url;
			document.forms[0].submit();
		}
		parent.document.body.removeChild(Super.getParentObject("popupAddrSingle"));
		parent.document.body.removeChild(Super.getParentObject("bodybgSingle"));
	}
	/*
	 * Popup弹出函数 msgType 弹出类型 1:成功 2:失败 3:警告 4:提示 5:编辑框弹出
	 * 
	 */
	var popupCount=0;// 设一计数器
	Super.Popup=function (popType,popTitle,popUrl,popText,popWidth,popHeight){
		if(typeof sessionErrorFlag == "undefined"){
			popupCount+=1;
		}else{
			if(sessionErrorFlag!=null){
				popupCount=sessionErrorFlag==1?2:2;
			}else{
				popupCount+=1;
			}
		}
		var arrayPageSize   = Super.getPageSize();// 调用getPageSize()函数
		var arrayPageScroll = Super.getPageScroll();// 调用getPageScroll()函数
		if(typeof popWidth == "undefined"){
			popWidth=300;
			popHeight=100;
		}	
		if (!parent.document.getElementById("popupAddr"+popupCount)){			
			var popupDiv = parent.document.createElement("div");		
			// 给这个元素设置属性与样式
			popupDiv.setAttribute("id","popupAddr"+popupCount);
			popupDiv.style.position = "absolute";
			popupDiv.style.border = "2px solid #5894E1";
			popupDiv.style.background = "#fdfdff";
			popupDiv.style.zIndex = popupCount*99;		
			// 创建弹出背景层
			var bodyBack = parent.document.createElement("div");
			bodyBack.setAttribute("id","bodybg"+popupCount);
			bodyBack.style.position = "absolute";
			bodyBack.style.width = "100%";
			bodyBack.style.height = (arrayPageSize[1] + 35 + 'px');
			bodyBack.style.zIndex = popupCount*98;
			bodyBack.style.top = "0";
			bodyBack.style.left = "0";		
			bodyBack.style.filter = "alpha(opacity=20)";
			bodyBack.style.opacity = "0.5";
			bodyBack.style.background = "#000";
			
			// 创建遮罩的Iframe层
			var bodyIframe = parent.document.createElement("iframe");
			bodyIframe.setAttribute("id","bodyIframe"+popupCount);
			bodyIframe.style.position = "absolute";		
			bodyIframe.style.width = "100%";
			bodyIframe.style.height = "100%";
			bodyIframe.style.zIndex = "-1";
			bodyIframe.style.top = "0";
			bodyIframe.style.left = "0";
			bodyIframe.style.scrolling= "no"
			bodyIframe.style.filter = "alpha(opacity=1)";
			bodyIframe.style.opacity = "0.5";
			bodyIframe.style.background = "#000";
			bodyIframe.frameBorder = "0";
			bodyIframe.src="about:blank";
					
			// 实现弹出(插入到目标元素之后)
			parent.document.body.appendChild(popupDiv);		
			parent.document.body.appendChild(bodyBack);	
			// alert(parent.document.body.innerHTML);
			bodyBack.appendChild(bodyIframe);
				
		}else{
			// Super.getParentObject("msgImg"+popupCount).innerHTML="";
		}
		
		
		// 显示背景层
		parent.document.getElementById("bodybg"+popupCount).style.display = "";	
		var iframeTempObj=parent.document.getElementById("bodyIframe"+popupCount);
		iframeTempObj.innerHTML;
		
		// 创建内容层中元素
		if(!parent.document.getElementById("popupAddr"+popupCount)) return false;
		
		var popObj=parent.document.getElementById("popupAddr"+popupCount);
		// alert(popObj.innerHTML);
		popObj.innerHTML="";		
		// alert(popObj.innerHTML);
		if(!parent.document.getElementById("msgHeader"+popupCount)){
			// 弹出层标题
			var msgHeader=parent.document.createElement("h1");
			msgHeader.setAttribute("id","msgHeader"+popupCount);
			msgHeader.clasName="msgHeader";
			msgHeader.innerHTML=popTitle;
			popObj.appendChild(msgHeader);			
							
			var msgImg=parent.document.createElement("img");// close image
			msgImg.setAttribute("id","msgImg"+popupCount);
			msgImg.setAttribute("src","/SCMDB/images/msgClose.gif");
			msgImg.setAttribute("title","关闭");			
			msgHeader.appendChild(msgImg);
			Super.getParentObject("msgImg"+popupCount).onclick=function (){Super.closeLayer("");}
			
			msgDetail=parent.document.createElement("p");
			msgDetail.setAttribute("id","msgDetail"+popupCount);
			msgDetail.style.background="url(/SCMDB/images/msgImg_0"+popType+".gif) no-repeat 0 0px";
			msgDetail.style.position = "relative";
			msgDetail.style.width=(popWidth-80)+"px";
			msgDetail.style.height=(popHeight-70)+"px";
			msgDetail.style.zIndex = popupCount*1000;			
			msgDetail.style.overflow="hidden"
			popObj.appendChild(msgDetail);
			msgDetail.innerHTML=popType==5?"<iframe name=\"popIframe\" id=\"popIframe"+popupCount+"\" style=\"position:absolute;top:0px;right:0px;bottom:0px;left:0px;margin:0px;padding:0px;width:100%;height:100%;*width:"+(popWidth-50)+"px;overflow:hidden;\" src=\""+popUrl+"\" frameborder=\"0\" scrolling=\"auto\" ></iframe>":popText;			
			
			msgButton=parent.document.createElement("div");// close button
															// layer
			msgButton.setAttribute("id","msgButton"+popupCount);			
			msgButton.style.zIndex = popupCount*1000;
			popObj.appendChild(msgButton);
			var msgContent=popType==2?"<input id=\"msgCancel"+popupCount+"\" type='button' value='确定'/>":"<input id=\"msgConfirm"+popupCount+"\" type='button' value='确定' /><input id=\"msgCancel"+popupCount+"\" type='button' value='取消' />";
			msgButton.innerHTML=msgContent;
			if(Super.getParentObject("msgConfirm"+popupCount)){
				Super.getParentObject("msgConfirm"+popupCount).onclick=function (){Super.closeLayer(popUrl);}
			}
			if(Super.getParentObject("msgCancel"+popupCount)){
				Super.getParentObject("msgCancel"+popupCount).onclick=function (){Super.closeLayer("");}				
			}
			window.setTimeout("Super.getParentObject(\"msgCancel"+popupCount+"\").focus();", 50); 
		}		
		popObj.style.display = "";		
		// 让弹出层在页面中垂直左右居中(统一)
		popObj.style.width  = popWidth+"px";	
		popObj.style.top  = arrayPageScroll[1] + (arrayPageSize[3]-popHeight) / 2 + 'px';
		popObj.style.left = (arrayPageSize[0] - popWidth) / 2 + 'px';
		return false;
	}
	Super.closeLayer=function(url){
		if(url!=""){			
				if(Super.getParentObject("popIframe"+popupCount)){	
					if(Super.getParentObject("popIframe"+popupCount).contentWindow.document.forms.length>0){
						var getPopFormObj=Super.getParentObject("popIframe"+popupCount).contentWindow.document.forms[0];
						if(Super.checkvalue(getPopFormObj)==true){
							if (url.indexOf("/SCMDB/monitorAlarmAction!findAlarmByType.action?idAlarmType") >= 0) {
								// 此处是为了实时监控图中打开的报警页面关闭的时候，不要整体刷新页面
								
							} else {
								Super.getParentObject("popIframe"+popupCount).contentWindow.document.forms[0].submit();
								setTimeout("document.location.href=document.URL",500);
							}							
						}			
						else{
							return false;					
						}
					}
				}else{
					document.forms[0].action=url;
					document.forms[0].submit();
					// setTimeout("document.location.href=document.URL",500);
				}
			
		}
		if(popupCount==2){
			parent.document.body.removeChild(Super.getParentObject("popupAddr"+popupCount));
			parent.document.body.removeChild(Super.getParentObject("bodybg"+popupCount));
			
			if(typeof sessionErrorFlag == "undefined"){
				popupCount-=1;
				}
			else{
				if(sessionErrorFlag!=null){
					popupCount=0;
					sessionErrorFlag=null;
				}else{					
					popupCount-=1;
				}
			}
		}else{
			Super.getParentObject("popupAddr"+popupCount).style.display="none";
			Super.getParentObject("bodybg"+popupCount).style.display="none";
			popupCount=0;
		}
			
		// popupCount=popupCount==4?0:popupCount-1;
		// alert("最后的："+popupCount);
		return false;
		
	}
	/*
	 * alarmData url:del action
	 */
	Super.alarmData=function (url,flg){
		
		// 1表示逐个确认
		if(flg=='1'){
			var checkBox=document.getElementsByName("checkbox");
			var str="";
			for(i=0;i<checkBox.length;i++){		
				if(checkBox[i].checked == true){
					if(str==""){
						if(checkBox[i].value!="checkbox"){
							str=str+checkBox[i].value;
						}
			 		}else{
			 			str=str+","+checkBox[i].value;
			 		}						
				}
			}
			if(str==""){
				alert ('请选择至少一条记录! ');
			}
			else{
				document.forms[0].action=url+str;
				document.forms[0].submit();
			}
		}
		// 0表示全部确认
		if(flg=='0'){

			if(confirm("你确定确认全部记录吗?")) {
				document.forms[0].action=url;
				
				document.forms[0].submit();
				
			}

		}
		
	}
	